<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="str" uri="/WEB-INF/config/tld/string-util.tld" %>
<jsp:include page="../include/header.jsp" />
<script type="text/javaScript">
<!--
	/* pagination 페이지 링크 function */
	function listPage(){
		$('#viewForm').attr('action', '<c:url value="/daily/dailyList.do"/>');
		$('#viewForm').submit();
	}
	
	function modifyPage(){
		$('#viewForm').attr('action', '<c:url value="/daily/dailyWriteForm.do"/>');
		$('#viewForm').submit();
	}
	
	function updateStatusPage(flag){
		$('#sdl_flag_yn').val(flag);
		if(flag == "N"){
			if(confirm("삭제하시겠습니까?")){
				$('#viewForm').attr('action', '<c:url value="/daily/dailyUpdate.do"/>');
				$('#viewForm').submit();
			}
		}else{
			if(confirm("복원하시겠습니까?")){
				$('#viewForm').attr('action', '<c:url value="/daily/dailyUpdate.do"/>');
				$('#viewForm').submit();
			}
		}
	}
-->
</script>
	<!-- contents s -->
<div class="container" id="container">
	<form name="viewForm" id="viewForm" action="<c:url value="/daily/dailyWriteForm.do"/>" method="post">
		<input type="hidden" name="sdl_dlog_key" id="sdl_dlog_key" value="${resultVO.sdl_dlog_key }"/>
		<input type="hidden" name="sdl_area_key" id="sdl_area_key" value="${resultVO.sdl_area_key }"/>
		<input type="hidden" name="sdl_flag_yn" id="sdl_flag_yn" value="${resultVO.sdl_flag_yn }"/>
	<span class="round lt">&nbsp;</span>
	<span class="round rt">&nbsp;</span>
	<span class="round lb">&nbsp;</span>
	<span class="round rb">&nbsp;</span>
	<div class="container_area">
		<h2 class="tit_h2">${resultVO.sdl_area_name } 오수처리시설 점검 일지</h2>
           	<p class="tit_sub">${resultVO.sdl_daily_date } ${weekAsString }요일</p>
			<jsp:include page="../include/navi.jsp" />
			<span class="ico_print"><a href="#print"  onclick="printPage('<c:url value="/common/dailyPrintView.do" />?sdl_dlog_key=${resultVO.sdl_dlog_key }');return false;"><img src="/htmlRes/images/ico_print.jpg" alt="인쇄버튼"></a></span>
			<h3 class="tit_h3">오수 발생량 (㎥/일)</h3>
			<div class="table_wrap"><!-- D : table은 div table_wrap 싸고감 -->
				<table summary="오수 발생량 테이블 입니다" class="table_list">
					<caption>오수 발생량</caption>
					<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
						<col span="4" width="25%" />
					</colgroup>
					<thead>
						<tr>
							<th scope="col">구분</th>
							<th scope="col">전일 지침</th>
							<th scope="col">금일 지침</th>
							<th scope="col">발생량</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>유입량</td>
							<td>${resultVO.pre_sdl_iflow_dwater }</td>
							<td>${resultVO.sdl_iflow_dwater }</td>
							<td>${(resultVO.sdl_iflow_dwater)-(resultVO.pre_sdl_iflow_dwater) }</td>
						</tr>
						 <tr>
							<td>방류량</td>
							<td>${resultVO.pre_sdl_oflow_dwater }</td>
							<td>${resultVO.sdl_oflow_dwater }</td>
							<td>${resultVO.sdl_oflow_dwater-resultVO.pre_sdl_oflow_dwater }</td>
						</tr>
					</tbody>
				</table>
			</div><!--//table_wrap-->
				
			<h3 class="tit_h3">전력 사용량 (kw/일)</h3>
			<div class="table_wrap"><!-- D : table은 div table_wrap 싸고감 -->
				<table summary="전력 사용량 테이블 입니다" class="table_list">
					<caption>전력 사용량</caption>
					<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
						<col span="4" width="25%" />
					</colgroup>
					<thead>
						<tr>
							<th scope="col">구분</th>
							<th scope="col">전일 지침</th>
							<th scope="col">금일 지침</th>
							<th scope="col">사용량</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>처리시설</td>
							<td>${resultVO.pre_sdl_elect_number }</td>
							<td>${resultVO.sdl_elect_number }</td>
							<td>${resultVO.sdl_elect_number-resultVO.pre_sdl_elect_number }</td>
						</tr>
					</tbody>
				</table>
			</div><!--//table_wrap-->
			
			<h3 class="tit_h3">약품사용 및 재고 현황</h3>
			<div class="table_wrap"><!-- D : table은 div table_wrap 싸고감 -->
				<table summary="약품사용 및 재고 현황 테이블 입니다" class="table_list">
					<caption>약품사용 및 재고 현황</caption>
					<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
						<col width="15%" />
						<col width="17%" />
						<col width="17%" />
						<col width="17%" />
						<col width="17%" />
						<col width="17%" />
					</colgroup>
					<thead>
						<tr>
							<th scope="col">약품명</th>
							<th scope="col">전일 이월량(kg)</th>
							<th scope="col">금일 재고량(kg)</th>
							<th scope="col">금일 사용량(kg)</th>
							<th scope="col">입고량(kg)</th>
							<th scope="col">비고</th>
						</tr>
					</thead>
					<tbody>
					<c:if test="${not empty resultVO.invenVOList}">
						<c:forEach var="result" items="${resultVO.invenVOList }" varStatus="status"> 
						<tr>
							<td style="display:none;"><input type="text" name="invenVOList[${status.count-1}].sui_code_key" value="${result.sui_code_key }" /></td>
							<td>${result.sui_code_name }</td>
							<td>${result.pre_sui_total_stock }</td>
							<td>${result.sui_total_stock }</td>
							<td>${result.sui_use_num }</td>
							<td>${result.sui_in_num }</td>
							<td>${result.sui_use_note }</td>
						</tr>
						</c:forEach>
					</c:if>
					</tbody>
				</table>
			</div><!--//table_wrap-->
			<h3 class="tit_h3">기기류 점검 및 작업사항</h3>
			<div class="table_wrap"><!-- D : table은 div table_wrap 싸고감 -->
				<table summary="기기류 점검 및 작업사항 테이블 입니다" class="table_list">
					<caption>기기류 점검 및 작업사항</caption>
					<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
						<col width="20%" />
						<col width="10%" />
						<col width="10%" />
						<col width="10%" />
						<col width="50%" />
					</colgroup>
					<thead>
						<tr>
							<th scope="col" rowspan="2" class="bdR">항목</th>
							<th scope="col" colspan="3" class="bdB">점검 결과</th>
							<th scope="col" rowspan="2" class="bdL">작업사항</th>
						</tr>
						<tr>
							<th scope="col">양호</th>
							<th scope="col" class="bdL">보통</th>
							<th scope="col"  class="bdL">불량</th>
						</tr>
					</thead>
					<tbody>
						<c:if test="${not empty resultVO.dailyMachineVOList}">
							<c:forEach var="result" items="${resultVO.dailyMachineVOList }" varStatus="status"> 
							<tr>
								<td>${result.scm_check_name }</td>
								<td><c:if test="${result.scm_check_result eq 'A'}"><img src="<c:url value='/htmlRes/images/img_radio.jpg'/>" alt="선택" /></c:if></td>
								<td><c:if test="${result.scm_check_result eq 'B'}"><img src="<c:url value='/htmlRes/images/img_radio.jpg'/>" alt="선택" /></c:if></td>
								<td><c:if test="${result.scm_check_result eq 'C'}"><img src="<c:url value='/htmlRes/images/img_radio.jpg'/>" alt="선택" /></c:if></td>
								<td>${result.scm_check_note }</td>
							</tr>
							</c:forEach>
						</c:if>
					</tbody>
				</table>
			</div><!--//table_wrap-->
			<h3 class="tit_h3">슬러지 처리량</h3>
			<div class="table_wrap"><!-- D : table은 div table_wrap 싸고감 -->
				<table summary="슬러지 처리량 테이블 입니다" class="table_list">
					<caption>슬러지 처리량</caption>
					<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
						<col span="3" width="33.3%" />
					</colgroup>
					<thead>
						<tr>
							<th scope="col">용량</th>
							<th scope="col">업체명</th>
							<th scope="col">금액</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>${resultVO.sdl_sludge_volm }</td>
							<td>${resultVO.sdl_sludge_comp }</td>
							<td>${resultVO.sdl_sludge_cost }</td>
						</tr>
					</tbody>
				</table>
			</div><!--//table_wrap-->
			
			<h3 class="tit_h3">방류 수질 검사 (자가 측정 대행)</h3>
			<div class="table_wrap"><!-- D : table은 div table_wrap 싸고감 -->
				<table summary="방류 수질 검사 (자가 측정 대행) 테이블 입니다" class="table_list">
					<caption>방류 수질 검사 (자가 측정 대행)</caption>
					<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
						<col width="16.5%" />
						<col width="16.5%" />
						<col width="16.5%" />
						<col width="16.5%" />
						<col width="16.5%" />
						<col width="17.5%" />
					</colgroup>
					<thead>
						<tr>
							<th scope="col">항목</th>
							<th scope="col">BOD</th>
							<th scope="col">SS</th>
							<th scope="col">T-N</th>
							<th scope="col">T-P</th>
							<th scope="col">총대장균군</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>수질기준</td>
							<td>10</td>
							<td>10</td>
							<td>20</td>
							<td>2</td>
							<td>3000m/ml</td>
						</tr>
						<tr>
							<td>결과치</td>
							<td>${resultVO.sdl_bod_num }</td>
							<td>${resultVO.sdl_ss_num }</td>
							<td>${resultVO.sdl_tn_num }</td>
							<td>${resultVO.sdl_tp_num }</td>
							<td>${resultVO.sdl_ec_num }</td>
						</tr>

					</tbody>
				</table>
			</div><!--//table_wrap-->
			<h3 class="tit_h3">시험성적서</h3>
			<div class="table_wrap">
				<table summary="특이사항 목록 입니다" class="table_write">
				<caption>특이사항 목록</caption>
				<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
					<col width="15%" />
					<col width="85%" />
				</colgroup>
				<tbody>
					<tr>
						<th scope="row">첨부파일</th>
						<td class="alL">
							<c:if test="${not empty resultVO.sdl_dlog_file }">
								<c:set var="saveFile" value="${fn:split(resultVO.sdl_dlog_file,'**')}" />
								<a href="<c:url value='/fileDownload.do'/>?fileInfo=${resultVO.sdl_dlog_file}" onclick="fileDown();return false;" class="file_down ${str:getFileType(saveFile[0])}" >${saveFile[1] }(${saveFile[2]})</a>
							</c:if>
						</td>
					</tr>
				</tbody>
				</table>
			</div>
			<h3 class="tit_h3">특이사항</h3>
			<!-- 수정
			<div class="radio_sec">
				<ul class="radio_area">
					<li>보통 <c:if test="${resultVO.sdl_unusual_yn eq 'Y'}"><img src="<c:url value='/htmlRes/images/img_radio.jpg'/>" alt="선택" /></c:if></li>
					<li>심각 <c:if test="${resultVO.sdl_unusual_yn eq 'N'}"><img src="<c:url value='/htmlRes/images/img_radio.jpg'/>" alt="선택" /></c:if></li>
				</ul>
				${resultVO.sdl_unusual_cont}
			</div>
			-->
			
			<div class="table_wrap">
				<table summary="특이사항 목록 입니다" class="table_write">
					<caption>특이사항 목록</caption>
					<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
						<col width="15%" />
						<col width="85%" />
					</colgroup>
					<tbody>
						<tr>
							<th scope="row">상태</th>
							<td class="alL">
								<ul class="radio_area">
									<li>보통 <c:if test="${resultVO.sdl_unusual_yn eq 'Y'}"><img src="<c:url value='/htmlRes/images/img_radio.jpg'/>" alt="선택" /></c:if></li>
									<li>심각 <c:if test="${resultVO.sdl_unusual_yn eq 'N'}"><img src="<c:url value='/htmlRes/images/img_radio.jpg'/>" alt="선택" /></c:if></li>
								</ul>
							</td>
						</tr>
						<tr>
							<th scope="row">내용</th>
							<td class="alL">${resultVO.sdl_unusual_cont}</td>
						</tr>							
					</tbody>
				</table>
			</div>
			
			<div class="btn_bbs">
				<a href="<c:url value="/daily/dailyList.do"/>" onclick="listPage();return false;" class="btn_wh">목록</a>
				<c:if test="${resultVO.sdl_flag_yn eq 'Y'}">
					<a href="<c:url value="/daily/dailyWriteForm.do"/>" onclick="modifyPage();return false;" class="btn_re">수정</a>
					<a href="<c:url value="/daily/dailyUpdate.do"/>" onclick="updateStatusPage('N');return false;" class="btn_gy">삭제</a>
				</c:if>
				<c:if test="${resultVO.sdl_flag_yn eq 'N'}">
					<a href="<c:url value="/daily/dailyUpdate.do"/>" onclick="updateStatusPage('Y');return false;" class="btn_gy">복원</a>
				</c:if>
			</div>
	
	</div><!--//container_area-->
		<!-- 페이징 유지  -->
		<input type="hidden" name="pageIndex" id="pageIndex" value="${resultVO.pageIndex }"/>
		</form>
</div>
<jsp:include page="../include/fileDownload.jsp" flush="false">
	<jsp:param name="fileInfo" value="${resultVO.sdl_dlog_file}" />
</jsp:include>
<jsp:include page="../include/footer.jsp" />
